﻿using Minecraft.Config.Csv.CsvCom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Minecraft.Config.Csv.CsvCls
{
	public partial class Mod_Drop
	{
		/// <summary>
		/// 获取物品掉落信息列表
		/// </summary>
		/// <returns></returns>
		public List<ModDropItemInfo> GetModDropItemInfoList_Convert()
		{
			List<ModDropItemInfo> modDropItemInfoList = new List<ModDropItemInfo>();
			var drops = Item_drop.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
			foreach (var drop in drops)
			{
				var t = drop.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
				var countStrs = t[1].Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(m => int.Parse(m));
				modDropItemInfoList.Add(new ModDropItemInfo
				{
					itemId = t[0],
					minCount = countStrs[0],
					maxCount = countStrs[1],
					dropRate = int.Parse(t[2]),
				});
			}
			return modDropItemInfoList;
		}
	}
}
